package com.bawei.room_test;

import androidx.appcompat.widget.TintTypedArray;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.PrimaryKey;

@Entity(tableName = "student2")
public class Student {
    @PrimaryKey(autoGenerate = true)
    @ColumnInfo(name = "id",typeAffinity = ColumnInfo.INTEGER)
    private int id;
    @ColumnInfo(name = "username",typeAffinity = ColumnInfo.TEXT)
    private String username;
    @ColumnInfo(name = "age",typeAffinity = ColumnInfo.INTEGER)
    private int age;
    //V2.0
//    @ColumnInfo(name = "sex", typeAffinity = ColumnInfo.INTEGER)
//    public int sex;
    //V3.0
    @ColumnInfo(name = "sex", typeAffinity = ColumnInfo.TEXT)
    public String sex;
    @Override
    public String toString() {
        return "Student{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", age=" + age +
                '}';
    }
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Student(int id, String username, int age) {
        this.id = id;
        this.username = username;
        this.age = age;
    }
}
